﻿#include "CommandManagerPy.h"
#include <QDebug>
#include "BaseModule/IBaseSignal.h"
#include "BaseModule/GlobalHelper.h"
#include "CommandManager/CommandManager.h"
#include <iostream>

namespace CommandManager
{
    CommandManagerPy* CommandManagerPy::m_instance = nullptr;

    CommandManagerPy* CommandManagerPy::getInstance()
    {
        if (m_instance == nullptr)
        {
            m_instance = new CommandManagerPy;
        }
        return m_instance;
    }

    CommandManagerPy::CommandManagerPy()
    {
        CommandManagerInstance;
        initConnect();
    }

    void CommandManagerPy::initConnect()
    {
    }

    void CommandManagerPy::putErrorMsg(QString content)
    {
        emit IBaseSignalInstance->signal_showMessageToConsole(BaseModule::EMessageConsole::Error, content);
    }

    void CommandManagerPy::slot_undo()
    {
        CommandManagerInstance->slot_execCommandManager(BaseModule::ECommandManager::Undo);
        emit IBaseSignalInstance->signal_execScriptManager(BaseModule::EScriptManager::Unlock);
    }

    void CommandManagerPy::slot_redo()
    {
        CommandManagerInstance->slot_execCommandManager(BaseModule::ECommandManager::Redo);
        emit IBaseSignalInstance->signal_execScriptManager(BaseModule::EScriptManager::Unlock);
    }

} // namespace CommandManager

//-----------------------------------------------------------------------

void undo()
{
    CommandManagerPyInstance->slot_undo();
}

void redo()
{
    CommandManagerPyInstance->slot_redo();
}

void smartScriptSave(char* fileName)
{
    emit CommandManagerPyInstance->signal_smartScriptSave(QString(fileName));
}

void smartScriptRun(char* fileName, bool isNoGui, char* listPara)
{
    emit CommandManagerPyInstance->signal_smartScriptRun(QString(fileName), isNoGui, QString(listPara));
}

void smartScriptEdit(char* fileName, char* text)
{
    emit CommandManagerPyInstance->signal_smartScriptEdit(QString(fileName), QString(text));
}

void projectTreeSelectionChanged(char* projectTreeSelctedRowIDListStr)
{
    emit CommandManagerPyInstance->signal_projectTreeSelectionChanged(QString(projectTreeSelctedRowIDListStr));
}

void saveGraph(char* filePath)
{
    qDebug() << "saveGraph exec start.";
    emit CommandManagerPyInstance->signal_saveGraph(QString(filePath));
    qDebug() << "saveGraph exec completed.";
}

void dataImport(char* filePath, bool isTextOrCsv, char* customData)
{
    emit CommandManagerPyInstance->signal_dataImport(QString(filePath), isTextOrCsv, QString(customData));
}

void createTwoDLineChart(int lineChartType, int variableIndex, char* chosenkeyList, char* valueIndexs, char* selectParserIndex, bool isOpenNewWindow)
{
    auto _chosenkeyList = GlobalHelperInstance->convertStringToPairIntIntList(chosenkeyList);
    auto _valueIndexs = GlobalHelperInstance->convertStringToIntList(valueIndexs);
    auto _selectParserIndex = GlobalHelperInstance->convertStringToIntList(selectParserIndex);
    emit CommandManagerPyInstance->signal_createTwoDLineChart(lineChartType, variableIndex, _chosenkeyList, _valueIndexs, _selectParserIndex, isOpenNewWindow);
}

void setHeatMapSelectedCurveNameIndexs(int windowId, char* selectedCurveNameIndexs)
{
    auto _selectedCurveNameIndexs = GlobalHelperInstance->convertStringToIntList(selectedCurveNameIndexs);
    emit CommandManagerPyInstance->signal_setHeatMapSelectedCurveNameIndexs(windowId, _selectedCurveNameIndexs);
}

void setHeatMapVariableAxisChanged(int windowId, int variableAxisIndex)
{
    emit CommandManagerPyInstance->signal_setHeatMapVariableAxisChanged(windowId, variableAxisIndex);
}

void setHeatMapFixedValueChanged(int windowId, char* indexList)
{
    auto _indexList = GlobalHelperInstance->convertStringToIntList(indexList);
    emit CommandManagerPyInstance->signal_setHeatMapFixedValueChanged(windowId, _indexList);
}

void setHeatMapSecondVariableAxisChanged(int windowId, int variableAxisIndex)
{
    emit CommandManagerPyInstance->signal_setHeatMapSecondVariableAxisChanged(windowId, variableAxisIndex);
}

void setHeatMapCurveNameCheckStateChanged(int windowId, int curveNameIndex, bool checkState)
{
    emit CommandManagerPyInstance->signal_setHeatMapCurveNameCheckStateChanged(windowId, curveNameIndex, checkState);
}

void setHeatMapDataOprationChanged(int windowId, bool isLoged, bool isNormalized)
{
    emit CommandManagerPyInstance->signal_setHeatMapDataOprationChanged(windowId, isLoged, isNormalized);
}

void setHeatMapResultValueDataChanged(int windowId, int resultValueIndex)
{
    emit CommandManagerPyInstance->signal_setHeatMapResultValueDataChanged(windowId, resultValueIndex);
}

void setHeatMapComplexPartsChanged(int windowId, bool isAmplitudeChecked, bool isPhaseChecked, bool isRealPartChecked, bool isImaginaryPartChecked)
{
    emit CommandManagerPyInstance->signal_setHeatMapComplexPartsChanged(windowId, isAmplitudeChecked, isPhaseChecked, isRealPartChecked, isImaginaryPartChecked);
}

void setHeatMapRemoveSelectedGraph(int windowId)
{
    emit CommandManagerPyInstance->signal_setHeatMapRemoveSelectedGraph(windowId);
}

void setHeatMapRenameFinished(int windowId, char* name)
{
    emit CommandManagerPyInstance->signal_setHeatMapRenameFinished(windowId, QString(name));
}

void setHeatMapAddTracer(int windowId, char* name, double x, double y, double value, int tracerStyle, int size, int penR, int penG, int penB, int penA, int interpolating, int curveInfoID, int tracerIndex)
{
    emit CommandManagerPyInstance->signal_setHeatMapAddTracer(windowId, QString(name), x, y, value, tracerStyle, size, penR, penG, penB, penA, interpolating, curveInfoID, tracerIndex);
}

void setHeatMapRemoveSelectedTracer(int mainWindowId, char* sinfoIdList)
{
    QList<int> infoidList = GlobalHelperInstance->convertStringToIntList(QString(sinfoIdList));
    emit CommandManagerPyInstance->signal_setHeatMapRemoveSelectedTracer(mainWindowId, infoidList);
}

void setHeatMapRemoveAllTracer(int mainWindowId, char* sinfoIdList)
{
    QList<int> infoidList = GlobalHelperInstance->convertStringToIntList(QString(sinfoIdList));
    emit CommandManagerPyInstance->signal_setHeatMapRemoveAllTracer(mainWindowId, infoidList);
}

void setHeatMapExportMarkerData(int mainWindowId, char* fileName)
{
    emit CommandManagerPyInstance->signal_setHeatMapExportMarkerData(mainWindowId, QString(fileName));
}

void setHeatMapChangeTracerProperty(int mainWindowId, char* name, int symbolStyle, int size, int penR, int penG, int penB, int penA, int tracerID)
{
    emit CommandManagerPyInstance->signal_setHeatMapChangeTracerProperty(mainWindowId, QString(name), symbolStyle, size, penR, penG, penB, penA, tracerID);
}

void saveHeatMapMainSettingData(int windowId, bool scalarBarIsAutoRange, double scalarBarMin,
                                double scalarBarMax, char* scalarBarColor, int scalarBarFontSize, bool XAxisAutoTitle, char* XAxisTitle, char* XTitleFontColor,
                                int XTitleFontSize, char* XAxisColor, double XAisThickness, int XValuePrecision, char* XAxisDigitColor,
                                int XAxisDigitSize, bool XAxisIsAutoRange, double XAxisMax, double XAxisMin, bool XIsAutoStepSize,
                                double XCustomStepSize, bool YAxisAutoTitle, char* YAxisTitle, char* YTitleFontColor, int YTitleFontSize, char* YAxisColor,
                                double YAisThickness, int YValuePrecision, char* YAxisDigitColor, int YAxisDigitSize, bool YAxisIsAutoRange,
                                double YAxisMax, double YAxisMin, bool YIsAutoStepSize, double YCustomStepSize, bool gridIsMainGridLineDisplay,
                                char* gridMainGridLineColor, int gridMainGridLineStyle, double gridMainGridLineThickness, bool gridIsSecondaryGridLineDisplay,
                                char* gridSecondaryGridLineColor, int gridSecondaryGridLineStyle, double gridSecondaryGridLineThickness,
                                char* windowTitleName, char* windowTitleFontColor, int windowTitleFontSize)
{
    emit CommandManagerPyInstance->signal_saveHeatMapMainSettingData(windowId, scalarBarIsAutoRange, scalarBarMin,
                                                                     scalarBarMax, QString(scalarBarColor), scalarBarFontSize, XAxisAutoTitle, QString(XAxisTitle), QString(XTitleFontColor),
                                                                     XTitleFontSize, QString(XAxisColor), XAisThickness, XValuePrecision, QString(XAxisDigitColor),
                                                                     XAxisDigitSize, XAxisIsAutoRange, XAxisMax, XAxisMin, XIsAutoStepSize,
                                                                     XCustomStepSize, YAxisAutoTitle, QString(YAxisTitle), QString(YTitleFontColor), YTitleFontSize, QString(YAxisColor),
                                                                     YAisThickness, YValuePrecision, QString(YAxisDigitColor), YAxisDigitSize, YAxisIsAutoRange,
                                                                     YAxisMax, YAxisMin, YIsAutoStepSize, YCustomStepSize, gridIsMainGridLineDisplay,
                                                                     QString(gridMainGridLineColor), gridMainGridLineStyle, gridMainGridLineThickness, gridIsSecondaryGridLineDisplay,
                                                                     QString(gridSecondaryGridLineColor), gridSecondaryGridLineStyle, gridSecondaryGridLineThickness,
                                                                     QString(windowTitleName), QString(windowTitleFontColor), windowTitleFontSize);
}

void lineChartSidebarVariableAxisChanged(int mainWindowId, char* sAllSelectedItemStr, int reuslt, char* sVariableAxistCurrentText)
{
    QList<int> _selectedIndexes = GlobalHelperInstance->convertStringToIntList(QString(sAllSelectedItemStr));
    emit CommandManagerPyInstance->signal_lineChartSidebarVariableAxisChanged(mainWindowId, _selectedIndexes, reuslt, QString(sVariableAxistCurrentText));
}

void lineChartSidebarCurveNameClicked(int mainWindowId, char* sselectedIndexes)
{
    QList<int> _selectedIndexes = GlobalHelperInstance->convertStringToIntList(QString(sselectedIndexes));
    emit CommandManagerPyInstance->signal_lineChartSidebarCurveNameClicked(mainWindowId, _selectedIndexes);
}

void lineChartSidebarCurveNameCheckStateChanged(int mainWindowId, int index, int checkStatus)
{
    emit CommandManagerPyInstance->signal_lineChartSidebarCurveNameCheckStateChanged(mainWindowId, index, checkStatus);
}

API_COMMANDMANAGER void lineChartSidebarFixedValueChanged(int mainWindowId, char* sAllIndexList)
{
    QList<int> _allIndexList = GlobalHelperInstance->convertStringToIntList(QString(sAllIndexList));
    emit CommandManagerPyInstance->signal_lineChartSidebarFixedValueChanged(mainWindowId, _allIndexList);
}

void lineChartSidebarDataOperationChanged(int mainWindowId, bool isNormChecked, bool isDBChecked, bool isMathOperationChecked)
{
    emit CommandManagerPyInstance->signal_lineChartSidebarDataOperationChanged(mainWindowId, isNormChecked, isDBChecked, isMathOperationChecked);
}

void lineChartSidebarValueDataChanged(int mainWindowId, int currentIndex)
{
    emit CommandManagerPyInstance->signal_lineChartSidebarValueDataChanged(mainWindowId, currentIndex);
}

void saveLineChartMainSettingData(int mainWindowId, int index, bool axiDisIsAutoName, char* axiDisTitleText, char* axiDisTitleFontColorStr, int axiDisTitleFontSize, char* axiDisAxisColorStr, int axiDisAxisThickness, double axiDisValuePrecision, char* axiDisAxisDigitColorStr, int axiDisAxisDigitSize,
                                  bool axiRangIsAutoRange, double axiRangMaxValue, double axiRangMinValue, bool axiRangIsAutoStepSize, double axiRangCustomStepSize,
                                  bool yAxiDisIsAutoName, char* yAxiDisTitleText, char* yAxiDisTitleFontColorStr, int yAxiDisTitleFontSize, char* yAxiDisAxisColorStr, int yAxiDisAxisThickness, double yAxiDisValuePrecision, char* yAxiDisAxisDigitColorStr, int yAxiDisAxisDigitSize,
                                  bool yAxiRangIsAutoRange, double yAxiRangMaxValue, double yAxiRangMinValue, bool yAxiRangIsAutoStepSize, double yAxiRangCustomStepSize,
                                  bool gridIsMainGridLineDisplay, char* gridMainGridLineColorStr, int gridMainGridLineStyle, double gridMainGridLineThickness, bool gridIsSecondaryGridLineDisplay, char* gridSecondaryGridLineColorStr, int gridSecondaryGridLineStyle, double gridSecondaryGridLineThickness,
                                  char* titleName, char* titleFontColorStr, int titleFontSize,
                                  char* legendFontColorStr, int legendFontSize, char* legendLineColorStr, int legendLineThickness,
                                  char* resultDataName, char* dataLineColorStr, int dataLineStyle, double dataLineThickness, bool isDisplaySymbol, int symbolStyle, double symbolSize, char* symbolColorStr)
{
    emit CommandManagerPyInstance->signal_saveLineChartMainSettingData(mainWindowId, index, axiDisIsAutoName, QString(axiDisTitleText), QString(axiDisTitleFontColorStr), axiDisTitleFontSize, QString(axiDisAxisColorStr), axiDisAxisThickness, axiDisValuePrecision, QString(axiDisAxisDigitColorStr), axiDisAxisDigitSize,
                                                                       axiRangIsAutoRange, axiRangMaxValue, axiRangMinValue, axiRangIsAutoStepSize, axiRangCustomStepSize,
                                                                       yAxiDisIsAutoName, QString(yAxiDisTitleText), QString(yAxiDisTitleFontColorStr), yAxiDisTitleFontSize, QString(yAxiDisAxisColorStr), yAxiDisAxisThickness, yAxiDisValuePrecision, QString(yAxiDisAxisDigitColorStr), yAxiDisAxisDigitSize,
                                                                       yAxiRangIsAutoRange, yAxiRangMaxValue, yAxiRangMinValue, yAxiRangIsAutoStepSize, yAxiRangCustomStepSize,
                                                                       gridIsMainGridLineDisplay, QString(gridMainGridLineColorStr), gridMainGridLineStyle, gridMainGridLineThickness, gridIsSecondaryGridLineDisplay, QString(gridSecondaryGridLineColorStr), gridSecondaryGridLineStyle, gridSecondaryGridLineThickness,
                                                                       QString(titleName), QString(titleFontColorStr), titleFontSize,
                                                                       QString(legendFontColorStr), legendFontSize, QString(legendLineColorStr), legendLineThickness,
                                                                       QString(resultDataName), QString(dataLineColorStr), dataLineStyle, dataLineThickness, isDisplaySymbol, symbolStyle, symbolSize, QString(symbolColorStr));
}

void polarCoordinateGraphSidebarVariableAxisChanged(int mainWindowId, char* sAllSelectedItemStr, int reuslt, char* sVariableAxistCurrentText)
{
    QList<int> _selectedIndexes = GlobalHelperInstance->convertStringToIntList(QString(sAllSelectedItemStr));
    emit CommandManagerPyInstance->signal_polarCoordinateGraphSidebarVariableAxisChanged(mainWindowId, _selectedIndexes, reuslt, QString(sVariableAxistCurrentText));
}

void polarCoordinateGraphSidebarAllVariableAxisChanged(int mainWindowId, char* sVariableAxistCurrentText)
{
    emit CommandManagerPyInstance->signal_polarCoordinateGraphSidebarAllVariableAxisChanged(mainWindowId, QString(sVariableAxistCurrentText));
}

void polarCoordinateGraphSidebarCurveNameClicked(int mainWindowId, char* sselectedIndexes)
{
    QList<int> _selectedIndexes = GlobalHelperInstance->convertStringToIntList(QString(sselectedIndexes));
    emit CommandManagerPyInstance->signal_polarCoordinateGraphSidebarCurveNameClicked(mainWindowId, _selectedIndexes);
}

void polarCoordinateGraphSidebarCurveNameCheckStateChanged(int mainWindowId, int index, int checkStatus)
{
    emit CommandManagerPyInstance->signal_polarCoordinateGraphSidebarCurveNameCheckStateChanged(mainWindowId, index, checkStatus);
}

void polarCoordinateGraphSidebarDataOperationChanged(int mainWindowId, bool isNormChecked, bool isDBChecked)
{
    emit CommandManagerPyInstance->signal_polarCoordinateGraphSidebarDataOperationChanged(mainWindowId, isNormChecked, isDBChecked);
}

void polarCoordinateGraphSidebarValueDataChanged(int mainWindowId, int currentIndex)
{
    emit CommandManagerPyInstance->signal_polarCoordinateGraphSidebarValueDataChanged(mainWindowId, currentIndex);
}

void polarCoordinateGraphSidebarDeleteAllGraph(int mainWindowId)
{
    emit CommandManagerPyInstance->signal_polarCoordinateGraphSidebarDeleteAllGraph(mainWindowId);
}

void polarCoordinateGraphSidebarCopySelectedGraph(int mainWindowId)
{
    emit CommandManagerPyInstance->signal_polarCoordinateGraphSidebarCopySelectedGraph(mainWindowId);
}

void polarCoordinateGraphAddTracer(int mainWindowId, char* name, double angle, int tracerStyle, int size, int penR, int penG, int penB, int penA,
    int brushR, int brushG, int brushB, int brushA, int interpolating, int curveInfoID, int tracerIndex)
{
    emit CommandManagerPyInstance->signal_polarCoordinateGraphAddTracer(mainWindowId, QString(name), angle, tracerStyle, size,
        penR, penG, penB, penA, brushR, brushG, brushB, brushA, interpolating, curveInfoID, tracerIndex);
}

void polarCoordinateGraphRemoveSelectedTracer(int mainWindowId, char* sinfoIdList, int curveInfoID)
{
    QList<int> infoidList = GlobalHelperInstance->convertStringToIntList(QString(sinfoIdList));
    emit CommandManagerPyInstance->signal_polarCoordinateGraphRemoveSelectedTracer(mainWindowId, infoidList, curveInfoID);
}

void polarCoordinateGraphRemoveAllTracer(int mainWindowId, char* sinfoIdList)
{
    QList<int> infoidList = GlobalHelperInstance->convertStringToIntList(QString(sinfoIdList));
    emit CommandManagerPyInstance->signal_polarCoordinateGraphRemoveAllTracer(mainWindowId, infoidList);
}

void polarCoordinateGraphExportMarkerData(int mainWindowId, char* fileName)
{
    emit CommandManagerPyInstance->signal_polarCoordinateGraphExportMarkerData(mainWindowId, QString(fileName));
}

void polarCoordinateGraphChangeTracerProperty(int mainWindowId, char* name, double x, int symbolStyle, int size, int penR, int penG, int penB, int penA, int tracerID)
{
    emit CommandManagerPyInstance->signal_polarCoordinateGraphChangeTracerProperty(mainWindowId, QString(name), x, symbolStyle, size, penR, penG, penB, penA, tracerID);
}

void polarCoordinateGraphSidebarRenameSelectedGraph(int mainWindowId, char* name)
{
    emit CommandManagerPyInstance->signal_polarCoordinateGraphSidebarRenameSelectedGraph(mainWindowId, QString(name));
}

void polarCoordinateGraphSidebarComplexPartsChanged(int windowId, bool isAmplitudeChecked, bool isPhaseChecked, bool isRealPartChecked, bool isImaginaryPartChecked)
{
    emit CommandManagerPyInstance->signal_polarCoordinateGraphSidebarComplexPartsChanged(windowId, isAmplitudeChecked, isPhaseChecked, isRealPartChecked, isImaginaryPartChecked);
}

void polarCoordinateGraphSidebarFixedValueChanged(int windowId, char* indexList)
{
    auto _indexList = GlobalHelperInstance->convertStringToIntList(indexList);
    emit CommandManagerPyInstance->signal_polarCoordinateGraphSidebarFixedValueChanged(windowId, _indexList);
}

void polarCoordinateGraphSidebarRemoveSelectedGraph(int windowId, char* indexList)
{
    auto _indexList = GlobalHelperInstance->convertStringToIntList(indexList);
    emit CommandManagerPyInstance->signal_polarCoordinateGraphSidebarRemoveSelectedGraph(windowId, _indexList);
}

void savePolarCoordinateGraphMainSettingData(int mainWindowId, int index, char* angDisAxisColor, int angDisAxisThickness, double angDisValuePrecision, char* angDisAxisDigitColor, int angDisAxisDigitSize,
                                             bool angRangIsAutoStepSize, double angRangCustomStepSize,
                                             char* radDisAxisColorStr, int radDisAxisThickness, double radDisValuePrecision, char* radDisAxisDigitColorStr, int radDisAxisDigitSize,
                                             bool radRangIsAutoRange, double radRangMaxValue, double radRangMinValue, bool radRangIsAutoStepSize, double radRangCustomStepSize,
                                             bool gridIsMainGridLineDisplay, char* gridMainGridLineColor, int gridMainGridLineStyle, double gridMainGridLineThickness,
                                             char* titleName, char* titleFontColor, int titleFontSize,
                                             char* legendFontColor, int legendFontSize, char* legendLineColor, int legendLineThickness,
                                             char* dataProResultDataName, char* dataProDataLineColor, int dataProDataLineStyle, double dataProDataLineThickness, bool dataProIsDisplaySymbol, int dataProSymbolStyle, double dataProSymbolSize, char* dataProSymbolColor)
{
    emit CommandManagerPyInstance->signal_savePolarCoordinateGraphMainSettingData(mainWindowId, index, QString(angDisAxisColor), angDisAxisThickness, angDisValuePrecision, QString(angDisAxisDigitColor), angDisAxisDigitSize,
                                                                                  angRangIsAutoStepSize, angRangCustomStepSize,
                                                                                  QString(radDisAxisColorStr), radDisAxisThickness, radDisValuePrecision, QString(radDisAxisDigitColorStr), radDisAxisDigitSize,
                                                                                  radRangIsAutoRange, radRangMaxValue, radRangMinValue, radRangIsAutoStepSize, radRangCustomStepSize,
                                                                                  gridIsMainGridLineDisplay, QString(gridMainGridLineColor), gridMainGridLineStyle, gridMainGridLineThickness,
                                                                                  QString(titleName), QString(titleFontColor), titleFontSize,
                                                                                  QString(legendFontColor), legendFontSize, QString(legendLineColor), legendLineThickness,
                                                                                  QString(dataProResultDataName), QString(dataProDataLineColor), dataProDataLineStyle, dataProDataLineThickness, dataProIsDisplaySymbol, dataProSymbolStyle, dataProSymbolSize, QString(dataProSymbolColor));
}

void threeDSurfacePlotSidebarCurveNameClicked(int windowId, char* selectedIndexes)
{
    QList<int> _selectedIndexes = GlobalHelperInstance->convertStringToIntList(QString(selectedIndexes));
    emit CommandManagerPyInstance->signal_threeDSurfacePlotSidebarCurveNameClicked(windowId, _selectedIndexes);
}

void threeDSurfacePlotSidebarFrequencyChanged(int windowId, int frequencyId)
{
    emit CommandManagerPyInstance->signal_threeDSurfacePlotSidebarFrequencyChanged(windowId, frequencyId);
}

void threeDSurfacePlotSidebarResultDataChanged(int windowId, int resultDataIndex)
{
    emit CommandManagerPyInstance->signal_threeDSurfacePlotSidebarResultDataChanged(windowId, resultDataIndex);
}

void threeDSurfacePlotSidebarDataOprationChanged(int windowId, bool isLoged, bool isNormalized)
{
    emit CommandManagerPyInstance->signal_threeDSurfacePlotSidebarDataOprationChanged(windowId, isLoged, isNormalized);
}

void threeDSurfacePlotSidebarCurveNameItemCheckStateChanged(int windowId, int itemIndex, bool checkState)
{
    emit CommandManagerPyInstance->signal_threeDSurfacePlotSidebarCurveNameItemCheckStateChanged(windowId, itemIndex, checkState);
}

void saveThreeDSurfacePlotMainSettingData(int windowId, int settingDataId, bool scalarBarIsAutoRange, double scalarBarMin, double scalarBarMax,
                                          bool scalarBarIsShowTitle, char* scalarBarTitle, char* scalarBarFontColor, int scalarBarFontSize, int geometryTransparency, char* resultGraphName,
                                          int resultGraphModelTransparency, double resultGraphScale, bool cubeAxesIsVisible)
{
    emit CommandManagerPyInstance->signal_saveThreeDSurfacePlotMainSettingData(windowId, settingDataId, scalarBarIsAutoRange, scalarBarMin, scalarBarMax,
                                                                               scalarBarIsShowTitle, QString(scalarBarTitle), QString(scalarBarFontColor), scalarBarFontSize, geometryTransparency, QString(resultGraphName),
                                                                               resultGraphModelTransparency, resultGraphScale, cubeAxesIsVisible);
}

void saveThreeDSurfacePlotMoveResultDataSetting(int windowId, int infomationId, double translationX, double translationY, double translationZ,
                                                double rotationTheta, double rotationPhi)
{
    emit CommandManagerPyInstance->signal_saveThreeDSurfacePlotMoveResultDataSetting(windowId, infomationId, translationX, translationY, translationZ,
                                                                                     rotationTheta, rotationPhi);
}

void createThreeDCloudMap(bool useNewWindow, int graphType, int variableIndex, int readerIndex, char* filePath, char* name, char* geometryFileName, int resultDataIndex)
{
    emit CommandManagerPyInstance->signal_createThreeDCloudMap(useNewWindow, graphType, variableIndex, readerIndex, QString(filePath), QString(name), QString(geometryFileName), resultDataIndex);
}

void threeDCloudMapSidebarCurveNameClicked(int windowId, char* selectedIndexes)
{
    QList<int> _selectedIndexes = GlobalHelperInstance->convertStringToIntList(QString(selectedIndexes));
    emit CommandManagerPyInstance->signal_threeDCloudMapSidebarCurveNameClicked(windowId, _selectedIndexes);
}

void threeDCloudMapSidebarItemCheckStateChanged(int windowId, int index, bool visible)
{
    emit CommandManagerPyInstance->signal_threeDCloudMapSidebarItemCheckStateChanged(windowId, index, visible);
}

void threeDCloudMapSidebarDataOprationChanged(int windowId, bool isLoged, bool isNormalized)
{
    emit CommandManagerPyInstance->signal_threeDCloudMapSidebarDataOprationChanged(windowId, isLoged, isNormalized);
}

void threeDCloudMapSidebarUpdateFixedParameter(int windowId, int index)
{
    emit CommandManagerPyInstance->signal_threeDCloudMapSidebarUpdateFixedParameter(windowId, index);
}

void threeDCloudMapSidebarUpdateOriginalDataSource(int mainWindowId, int index, int showType, int fixedValueIndex, bool isLog, bool isNormalize)
{
    emit CommandManagerPyInstance->signal_threeDCloudMapSidebarUpdateOriginalDataSource(mainWindowId, index, showType, fixedValueIndex, isLog, isNormalize);
}

void threeDCloudMapSidebarResultDataChanged(int windowId, int index)
{
    emit CommandManagerPyInstance->signal_threeDCloudMapSidebarResultDataChanged(windowId, index);
}

void threeDCloudMapSidebarNameItemRename(int windowId, int itemIndex, char* newName)
{
    emit CommandManagerPyInstance->signal_threeDCloudMapSidebarNameItemRename(windowId, itemIndex, QString(newName));
}

void threeDCloudMapSidebarDelete3DCloudMap(int windowId, char* selectedIndexs)
{
    emit CommandManagerPyInstance->signal_threeDCloudMapSidebarDelete3DCloudMap(windowId, QString(selectedIndexs));
}

void saveThreeDCloudMapMainSettingData(int windowId, int type, int settingDataId,
                                       bool scalarBarIsAutoRange, double scalarBarMin, double scalarBarMax,
                                       bool scalarBarIsShowTitle, char* scalarBarTitle, char* scalarBarFontColor, int scalarBarFontSize,
                                       int geometryTransparency, char* resultGraphName, int resultGraphModelTransparency, bool cubeAxesIsVisible)
{
    emit CommandManagerPyInstance->signal_saveThreeDCloudMapMainSettingData(windowId, type, settingDataId, scalarBarIsAutoRange,
                                                                            scalarBarMin, scalarBarMax, scalarBarIsShowTitle, QString(scalarBarTitle), QString(scalarBarFontColor), scalarBarFontSize,
                                                                            geometryTransparency, QString(resultGraphName), resultGraphModelTransparency, cubeAxesIsVisible);
}

void openProject()
{
    emit CommandManagerPyInstance->signal_openProject();
}
void importProjectData(char* data)
{
    emit CommandManagerPyInstance->signal_importProjectData(QString(data));
}

void lineChartWindowSetIsEdit(bool state) {
    emit CommandManagerPyInstance->signal_lineChartWindowSetIsEdit(state);
}
void lineChartChangeLineProperty(int windowUniversalID, int curveInfoID, char* docStr)
{
    emit CommandManagerPyInstance->signal_lineChartChangeLineProperty(windowUniversalID, curveInfoID, QString(docStr));
}

void centerWidgetTabWidgetCurrentChanged(int currentIndex) {
    emit CommandManagerPyInstance->signal_centerWidgetTabWidgetCurrentChanged(currentIndex);
}

void lineChartCurve2DPlotorGuideLineSelectRemove() {
    emit CommandManagerPyInstance->signal_lineChartCurve2DPlotorGuideLineSelectRemove();
}
void lineChartCurve2DPlotorGuideLineAllRemove() {
    emit CommandManagerPyInstance->signal_lineChartCurve2DPlotorGuideLineAllRemove();
}
void lineChartCurve2DPlotorMarkerSelectRemove() {
    emit CommandManagerPyInstance->signal_lineChartCurve2DPlotorMarkerSelectRemove();
}
void lineChartCurve2DPlotorMarkerAllRemove() {
    emit CommandManagerPyInstance->signal_lineChartCurve2DPlotorMarkerAllRemove();
}

void lineChartLineChartTracerSelectChange(int id, bool selected)
{
    emit CommandManagerPyInstance->signal_lineChartLineChartTracerSelectChange(id, selected);
}


void lineChartLineChartStraightLineSelectChange(int id, bool selected)
{
    emit CommandManagerPyInstance->signal_lineChartLineChartStraightLineSelectChange(id, selected);
}

void lineChartWindowChangeGuideLineProperty(int guideLineID, double value, int guideLineStyle, double guideLineThickness, char* guideLineColor)
{
    emit CommandManagerPyInstance->signal_lineChartWindowChangeGuideLineProperty(guideLineID, value, guideLineStyle, guideLineThickness, QString(guideLineColor));
}
void lineChartWindowChangeTracerProperty(int tracerID, char* tracerName, double x, int symbolStyle, double symbolSize, char* symbolColor)
{
    emit CommandManagerPyInstance->signal_lineChartWindowChangeTracerProperty(tracerID, QString(tracerName), x, symbolStyle, symbolSize, QString(symbolColor));
}
void lineChartAxisLineUpdate(char* typeAxis, int id, double value) {
    emit CommandManagerPyInstance->signal_lineChartAxisLineUpdate(QString(typeAxis), id, value);
}
void lineChartComputeHIRF(char* graphNames, double incidentWaveFieldValue, char* HIRFName, char* typeName, bool isCheckBoxChecked)
{
    emit CommandManagerPyInstance->signal_lineChartComputeHIRF(QString(graphNames), incidentWaveFieldValue, QString(HIRFName), QString(typeName), isCheckBoxChecked);
}

void lineChartSidebarSettingsRemoveSelectedGraph()
{

    emit CommandManagerPyInstance->signal_lineChartSidebarSettingsRemoveSelectedGraph();
}

void lineChartSidebarSettingsDeleteAllCurve()
{
    emit CommandManagerPyInstance->signal_lineChartSidebarSettingsDeleteAllCurve();
}

void lineChartCreateLineChartStraightLine(int typeAxis) {
    emit CommandManagerPyInstance->signal_lineChartCreateLineChartStraightLine(typeAxis);
}
void lineChartMeasureButtonClicked(int meaureTypeInt, double value) {
    emit CommandManagerPyInstance->signal_lineChartMeasureButtonClicked(meaureTypeInt, value);
}
void lineChartSidebarSettingsRenameCheck(char* text)
{
    emit CommandManagerPyInstance->signal_lineChartSidebarSettingsRenameCheck(QString(text));
}
void lineChartCenterWidgetMoveLegend(int dataInt) {
    emit CommandManagerPyInstance->signal_lineChartCenterWidgetMoveLegend(dataInt);
}

void lineChartWindowAddTracer(int windowUniversalID, char* parameters)
{
    emit CommandManagerPyInstance->signal_lineChartWindowAddTracer(windowUniversalID,QString(parameters));
}

void lineChartCenterWidgetDialogAddLocalRange(double rangeLower, double rangeUpper, char* selectNames, bool execFlag, bool edit) 
{
    emit CommandManagerPyInstance->signal_lineChartCenterWidgetDialogAddLocalRange(rangeLower, rangeUpper, QString(selectNames), execFlag, edit);
}
void lineChartCurve2DPlotorRemoveSelectedGraph()
{
    emit CommandManagerPyInstance->signal_lineChartCurve2DPlotorRemoveSelectedGraph();
}
void lineChartCurve2DPlotorRemoveAllGraphs()
{
    emit CommandManagerPyInstance->signal_lineChartCurve2DPlotorRemoveAllGraphs();
}
void lineChartDialogCurveSmoothing(double range)
{
    emit CommandManagerPyInstance->signal_lineChartDialogCurveSmoothing(range);
}
void lineChartDialogWaveformAnalysis(char* graphName, double cutOffFrequency, char* filterType, int filterOrder, char* leftBoundary, char* rightBoundary,int windowId, char* resultList)
{
    double lb;
    if (leftBoundary == "nan")
    {
        lb = std::numeric_limits<double>::quiet_NaN();
    }
    else
    {
        lb = atof(leftBoundary);
    }

    
    double rb;
    if (rightBoundary == "nan")
    {
        rb = std::numeric_limits<double>::quiet_NaN();
    }
    else
    {
        rb = atof(rightBoundary);
    }

    emit CommandManagerPyInstance->signal_lineChartDialogWaveformAnalysis(QString(graphName), cutOffFrequency, QString(filterType), filterOrder, lb, rb, windowId, QString(resultList));
}
void lineChartDialogIPLCalculation(char* IPLString)
{
    emit CommandManagerPyInstance->signal_lineChartDialogIPLCalculation(QString(IPLString));
}
void lineChartDialogTransferFunction(char* graphName, char* calibrationGraphName, char* type)
{
    emit CommandManagerPyInstance->signal_lineChartDialogTransferFunction(QString(graphName), QString(calibrationGraphName), QString(type));
}
void lineChartCenterWidgetInfoListPaste(char* infoIds)
{
    emit CommandManagerPyInstance->signal_lineChartCenterWidgetInfoListPaste(QString(infoIds));
}
void lineChartDialogInterpolation(int number, int type)
{
    emit CommandManagerPyInstance->signal_lineChartDialogInterpolation(number, type);
}

void lineChartComputeEffectiveness(char* graphNames, double e0) {
    emit CommandManagerPyInstance->signal_lineChartComputeEffectiveness(QString(graphNames), e0);
}

void lineChartSidebarSettingsAllVariableAxisSet(char* data)
{
    emit CommandManagerPyInstance->signal_lineChartSidebarSettingsAllVariableAxisSet(QString(data));
}


void lineChartSidebarSettingsComplex(char* data)
{
    emit CommandManagerPyInstance->signal_lineChartSidebarSettingsComplex(QString(data));
}
void lineChartSidebarSettingsFormulaEditor(char* data)
{
    emit CommandManagerPyInstance->signal_lineChartSidebarSettingsFormulaEditor(QString(data));
}
void lineChartSidebarSettingsCopySelectedGraph()
{
    emit CommandManagerPyInstance->signal_lineChartSidebarSettingsCopySelectedGraph();
}


void createThreeDSurfacePlot(int graphType, int variableIndex, int frequencyIndex, int readerIndex, char* filePath, char* name, char* geometryFileName, bool isOpenNewWindow)
{
    emit CommandManagerPyInstance->signal_createThreeDSurfacePlot(graphType, variableIndex, frequencyIndex, readerIndex, QString(filePath), QString(name), QString(geometryFileName), isOpenNewWindow);
}

void createSurfaceElectricFieldGraph(int graphType, int currentIndex, int readerIndex, char* sReaderType, char* sFilePath, char* sName, char* geometryFileName,bool isOpenNewWindow)
{
    emit CommandManagerPyInstance->signal_createSurfaceElectricFieldGraph(graphType, currentIndex, readerIndex, QString(sReaderType), QString(sFilePath), QString(sName), QString(geometryFileName),isOpenNewWindow);
}

void surfaceElectricFieldMapSidebarCurveNameClicked(int windowId, char* selectedIndexes)
{
    QList<int> _selectedIndexes = GlobalHelperInstance->convertStringToIntList(QString(selectedIndexes));
    emit CommandManagerPyInstance->signal_surfaceElectricFieldMapSidebarCurveNameClicked(windowId, _selectedIndexes);
}

void surfaceElectricFieldMapSidebarItemCheckStateChanged(int windowId, int index, bool visible)
{
    emit CommandManagerPyInstance->signal_surfaceElectricFieldMapSidebarItemCheckStateChanged(windowId, index, visible);
}

void surfaceElectricFieldMapSidebarResultDataChanged(int windowId, int index)
{
    emit CommandManagerPyInstance->signal_surfaceElectricFieldMapSidebarResultDataChanged(windowId, index);
}

void surfaceElectricFieldMapSidebarUpdateProcessData(int windowId, bool isLog, bool isNormalize)
{
    emit CommandManagerPyInstance->signal_surfaceElectricFieldMapSidebarUpdateProcessData(windowId, isLog, isNormalize);
}

void surfaceElectricFieldMapSidebarNameItemRename(int windowId, int itemIndex, char* newName)
{
    emit CommandManagerPyInstance->signal_surfaceElectricFieldMapSidebarNameItemRename(windowId, itemIndex, QString(newName));
}

void surfaceElectricFieldMapSidebarDeleteSurfaceElectricFieldMap(int windowId, char* selectedIndexs)
{
    emit CommandManagerPyInstance->signal_surfaceElectricFieldMapSidebarDeleteSurfaceElectricFieldMap(windowId, QString(selectedIndexs));
}

void saveSurfaceElectricFieldMapMainSettingData(int windowId, int type, int settingDataId,
                                                bool scalarBarIsAutoRange, double scalarBarMin, double scalarBarMax,
                                                bool scalarBarIsShowTitle, char* scalarBarTitle, char* scalarBarFontColor, int scalarBarFontSize,
                                                int geometryTransparency, char* resultGraphName, int resultGraphModelTransparency, bool cubeAxesIsVisible)
{
    emit CommandManagerPyInstance->signal_saveSurfaceElectricFieldMapMainSettingData(windowId, type, settingDataId, scalarBarIsAutoRange,
                                                                                     scalarBarMin, scalarBarMax, scalarBarIsShowTitle, QString(scalarBarTitle), QString(scalarBarFontColor), scalarBarFontSize,
                                                                                     geometryTransparency, QString(resultGraphName), resultGraphModelTransparency, cubeAxesIsVisible);
}

void savePostMarkerAddSettingData(int windowUniversalID, int infomationGraph3DBasicalId, int type,
                                  int fieldIndex, char* fieldName, int pickedId, char* pickedValue)
{
    emit CommandManagerPyInstance->signal_savePostMarkerAddSettingData(windowUniversalID, infomationGraph3DBasicalId, type, fieldIndex,
                                                                       fieldName, pickedId, pickedValue);
}

void savePostMarkerRemoveChosenSettingData(int windowUniversalID, char* removeChosenId)
{
    emit CommandManagerPyInstance->signal_savePostMarkerRemoveChosenSettingData(windowUniversalID, removeChosenId);
}

void savePostMarkerRemoveAllSettingData(int windowUniversalID)
{
    emit CommandManagerPyInstance->signal_savePostMarkerRemoveAllSettingData(windowUniversalID);
}

void savePostMarkerExportTableData(int windowUniversalID, char* fileName)
{
    emit CommandManagerPyInstance->signal_savePostMarkerExportTableData(windowUniversalID, fileName);
}

void saveModelDisplaySettingData(int windowUniversalID, bool toolButtonActiveClipperIsChecked, bool toolButtonModelDisplayIsChecked, bool hasAnyGeometrySuccess)
{
    emit CommandManagerPyInstance->signal_saveModelDisplaySettingData(windowUniversalID, toolButtonActiveClipperIsChecked,
                                                                      toolButtonModelDisplayIsChecked, hasAnyGeometrySuccess);
}

void saveActiveClipperSettingData(int windowUniversalID, bool toolButtonActiveClipperIsChecked, bool toolButtonModelDisplayIsChecked, bool hasAnyGeometrySuccess, char* direction, double clipperValue)
{
    emit CommandManagerPyInstance->signal_saveActiveClipperSettingData(windowUniversalID, toolButtonActiveClipperIsChecked,
                                                                       toolButtonModelDisplayIsChecked, hasAnyGeometrySuccess, QString(direction), clipperValue);
}

void createTableWidget(int readerIndex)
{
    emit CommandManagerPyInstance->signal_createTableWidget(readerIndex);
}

void hideOrShowTableColumn(int windowId, char* selectedIndex)
{
    emit CommandManagerPyInstance->signal_hideOrShowTableColumn(windowId, QString(selectedIndex));
}

void changeTbColumnName(int windowId, int index, char* newName)
{
    emit CommandManagerPyInstance->signal_changeTbColumnName(windowId, index, QString(newName));
}

void flushTbBySelectedRow(int windowId, char* parms)
{
    emit CommandManagerPyInstance->signal_flushTbBySelectedRow(windowId, QString(parms));
}

void doPrjFileWrite(char* fileName)
{
    emit CommandManagerPyInstance->signal_doPrjFileWrite(QString(fileName));
}

void doPrjFileRead(char* fileName)
{
    emit CommandManagerPyInstance->signal_doPrjFileRead(QString(fileName));
}

void doPrjCloseTree(int index)
{
    emit CommandManagerPyInstance->signal_doPrjCloseTree(index);
}

void doPrjTreeCopyDir(int index)
{
    emit CommandManagerPyInstance->signal_doPrjTreeCopyDir(index);
}

void doPrjTreePasteDir(int srcId, int destId)
{
    emit CommandManagerPyInstance->signal_doPrjTreePasteDir(srcId, destId);
}

void doPrjTreeCopyData(int index)
{
    emit CommandManagerPyInstance->signal_doPrjTreeCopyData(index);
}

void doPrjTreePasteData(int srcId, int destId)
{
    emit CommandManagerPyInstance->signal_doPrjTreePasteData(srcId, destId);
}

void doPrjTreeExpandDir(int index)
{
    emit CommandManagerPyInstance->signal_doPrjTreeExpandDir(index);
}

void doPrjTreeCollapseDir(int index)
{
    emit CommandManagerPyInstance->signal_doPrjTreeCollapseDir(index);
}

void exportTbData(int windowId, char* filePath, char* delimiter, int onlyVisible)
{
    emit CommandManagerPyInstance->signal_exportTbData(windowId, QString(filePath), QString(delimiter), onlyVisible);
}

void highlightSelectedTbColumns(int windowId, char* parms)
{
    emit CommandManagerPyInstance->signal_highlightSelectedTbColumns(windowId, QString(parms));
}

void closeCenterTableBar(int index)
{
    emit CommandManagerPyInstance->signal_closeCenterTableBar(index);
}

void changeCurrentTabBar(int index)
{
    emit CommandManagerPyInstance->signal_changeCurrentTabBar(index);
}

void submitEvaluation(int windowId, int evaluationType, char* parms)
{
    emit CommandManagerPyInstance->signal_submitEvaluation(windowId, evaluationType, QString(parms));
}

void exportData(char* filePath)
{
    emit CommandManagerPyInstance->signal_exportPstData(QString(filePath));
}

void delete3DSurfacePlots(int windowId, char* selectedIndexs)
{
    emit CommandManagerPyInstance->signal_delete3DSurfacePlots(windowId, QString(selectedIndexs));
}

 void threeDSurfaceCurveNameItemRename(int windowId, int itemIndex, char* newName)
{
     emit CommandManagerPyInstance->signal_threeDSurfaceCurveNameItemRename(windowId, itemIndex, QString(newName));
}

void threeDSurfaceCurveDataFileterRadioButtonClicked(int windowId, int index)
{
    emit CommandManagerPyInstance->signal_threeDSurfaceCurveDataFileterRadioButtonClicked(windowId, index);
}

 API_COMMANDMANAGER void sentWaveButterANdFFTVResult(int windowId, char* resultList)
 {
     emit CommandManagerPyInstance->signal_sentWaveButterANdFFTVResult(windowId, QString(resultList));
 }

 API_COMMANDMANAGER void saveGifSuccess(bool suc)
 {
     emit IBaseSignalInstance->signal_saveGifSuccess(suc);
 }
